#include "vector.h"
#include "misc.h"
Vector::Vector()
{
    d = new double[dim];
    for(int i = 0; i<dim; ++i)
        d[i]=0;
}

Vector(double x,double y,double z,int dim)
{
    this->dim = dim;
    this->Vector();//allocate the memory
    d[0]=x;
    d[1]=y;
    d[2]=z;
}

Vector::~Vector()
{
    delete d;//deallocate the memory
}

Vector* Vector:: operator+(Vector *op)
{

    return this->operator +(op->getCoords());
}
Vector* Vector::operator+(double *op)
{
    for(int i = 0; i<dim;++i)
        d[i] += op[i];
    return this;
}

Vector* Vector::operator*(Vector *op)
{
    return this->operator *(op.getCoords());
}

Vector* Vector::operator*(double *op)
{
    for(int i = 0; i<dim; ++i)
        d[i]*=op[i];
    return this;
}

Vector* Vector::operator*(double op)
{
    for(int i = 0; i<dim; ++i)
        d[i]*=op;
    return this;
}
